import path from "path";
import os from "os";
export const mediapath = "/static/blocks-media/";
const ardu_start = [
  "--verify", //验证
  "--upload", //上传
  "--board", //板子的名称
  "--port", //板子的串口号
  "--pref", //首选项
  "-v|--verbose", //详细信息
  "--preserve-temp-files", //保存 .hex 文件
  "FILE.ino" //文件路径
];
export const apppack = path.join(os.homedir(), ".hterobotapp/");
export const scratchpath = path.join(__dirname, "./scratch.html");
let arduino_cmd_guesses = path.join(apppack, "./Arduino/arduino_debug.exe");
export const textIno = path.join(apppack, "./ino/text.ino");
export const arduino_path = path.join(apppack, "./Arduino");
export const build_path = path.join(apppack, "./cache");
if (process.platform === "darwin") {
  arduino_cmd_guesses = path.join(
    apppack,
    "/Arduino.app/Contents/MacOS/Arduino"
  );
}
export const geiArduinoCmd = function(build, board = "arduino:avr:uno", port) {
  if (port == null) {
    return `"${arduino_cmd_guesses}" ${build} ${ardu_start[2]} ${board}    -v --pref "build.path=${build_path}"  --preserve-temp-files "${textIno}"`;
  } else {
    return `"${arduino_cmd_guesses}" ${build} ${ardu_start[2]} ${board} ${ardu_start[3]} ${port} -v --pref "build.path=${build_path}" --preserve-temp-files "${textIno}"`;
  }
};

export const Official = `

-------------------------------------------------------------
-------------------------------------------------------------
---------**------**--------**********--------**********------
---------**------**------------**------------**--------------
---------**------**------------**------------**--------------
---------**********------------**------------*********-------
---------**------**------------**------------**--------------
---------**------**------------**------------**--------------
---------**------**------------**------------**********------
-------------------------------------------------------------
-------------------------------------------------------------

`;
